package org.backend.service.impl;

import org.backend.pojo.entity.Admin;
import org.backend.repository.AdminRepository;
import org.backend.service.AdminService;
import org.backend.utils.ApiResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AdminServiceImpl implements AdminService {

    @Autowired
    AdminRepository adminRepository;

    @Override
    public ApiResponse<Admin> login(Admin admin) {
        Admin admin1 = adminRepository.login(admin.getAccount());
        if (admin1.getPassword().equals(admin.getPassword())){
            return ApiResponse.success(admin1);
        }
        return ApiResponse.error("登录失败");
    }
}
